export default{
  components: {
    
  },
  data(){
    return {
      hiddenSave:false,
      list$2:[],
      list$1:[],
    }
  },
  computed: {
    supCanCheck(){
      if(this.controlData.isSupOrg&&this.models.model.pStatus!=7){
        return false
      }else{
        return true
      }
    },
    canUpdatePerson(){// 安装单位可变更人员
      if(this.controlData.isInsOrg && this.models.model.pStatus>=0 && this.models.model.pStatus<7){
        return true
      }else{
        return false
      }
    },
  },
  watch: {
    list$2:{
      handler(val){
        let newArr=[...val,...this.list$1]
        this.handleHidden(newArr)
      },
      deep:true
    },
    list$1:{
      handler(val){
        let newArr=[...val,...this.list$2]
        this.handleHidden(newArr)
      },
      deep:true
    },
  },
  methods: {
    // 获取附件上传完整度 处理函数
    getFileComplete(typeCodes,dataKey,attachCraneType){
      return new Promise((resolve, reject) => {
        this.$f7.preloader.show();
        this.$util.getPromise(
          '/equipment/eqmCase/getAttachmentDegree', 
          {typeCodes,dataKey,attachCraneType}
        )
        .then(res => {
          this.$f7.preloader.hide();
          if(res&&res.success){
            let {uploadedRate,notUploadList,notUploadNum,uploadedNum}=res.parameters
            if(uploadedRate!='100%'){
              let arr=notUploadList.map((item,index)=>`${index+1}、${item.customName}`)
              let message=arr.join('\n')

              this.$dialog.confirm({
                title: `已上传${uploadedNum}项检查内容，还有以下${notUploadNum}项检查内容未上传，当前填写完成度为${uploadedRate}，是否继续提交？`,
                message,
                confirmButtonColor:'#1990FF',
                cancelButtonText:'否',
                confirmButtonText:'是',
                messageAlign:'left',
                className:'fileConfirm',
              })
              .then(() => {
                resolve(true)
              })
              .catch(() => {
                resolve(false)
              });
            }else{
              resolve(true)
            }
          }else{
            resolve(false)
          }
        })
        .catch(e=>{
          resolve(false)
          this.$f7.preloader.hide();
          console.log(e);
          this.$toast('获取数据失败')
        });
      })
    },
    handleHidden(arr){
      this.hiddenSave=arr.some(item=>item.isPass===0)
    },
  }
}
